package com.zmc.admin.controller.login;

import com.zmc.admin.application.CaptchaService;
import com.zmc.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 验证码操作处理
 * @author zmc
 */
@RestController
public class CaptchaController {


    @Autowired
    private CaptchaService captchaService;


    /**
     * 生成验证码
     */
    @PostMapping("/captchaImage")
    public R getCode(HttpServletResponse response) throws IOException {
        return R.ok().put(captchaService.getCode(response));
    }
}
